﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NHibernate.Cfg;
using NHibernate;
namespace MyGameServer
{
    public class NHiberateHelper
    {
  private static ISessionFactory _sessionFactory;
        private static ISessionFactory SessionFactory 
        {
            get {
                if (_sessionFactory==null) 
                {
                    var configuration = new Configuration();
                    configuration.Configure();
                    configuration.AddAssembly("MyGameServer");
                    _sessionFactory = configuration.BuildSessionFactory();
                }
                return _sessionFactory;
            }
        }

        public static ISession OPenSession() 
        {
            return SessionFactory.OpenSession();
        }
    }
}
